/*
 * Copyright 2008 Stuart Moffatt stuartmoffatt@gmail.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.googlecode.emcode.rvha.client.ui;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class NaturalHazards extends Composite {

	private SimplePanel panel;
	private VerticalPanel list;
	
	private CheckBox earthquake;
	private CheckBox liquefaction;
	private CheckBox landslide;
	private CheckBox flood;
	private CheckBox avalanchePaths;
	
	public NaturalHazards()
	{
	    panel = new SimplePanel();
	    list = new VerticalPanel();
	    panel.setWidget(list);
	    
	    earthquake = new CheckBox("Earthquake ground motion");
	    earthquake.addClickListener(new ClickListener() {
	        public void onClick(Widget sender) {
	        	CheckBox cb = (CheckBox) sender;
                MainLayout.get().toggleKml(MainLayout.KML_GROUND_MOTION, cb);
	        }
	    });
	    earthquake.setStyleName("rvha-Hazards");

	    
	    liquefaction = new CheckBox("Liquefaction potential");
	    liquefaction.addClickListener(new ClickListener() {
	        public void onClick(Widget sender) {
	        	CheckBox cb = (CheckBox) sender;
	        	MainLayout.get().toggleKml(MainLayout.KML_LIQUEFACTION, cb);
	        }
	    });
	    liquefaction.setStyleName("rvha-Hazards");
	    
	    landslide = new CheckBox("Landslide potential");
	    landslide.addClickListener(new ClickListener() {
	        public void onClick(Widget sender) {
	        	CheckBox cb = (CheckBox) sender;
                MainLayout.get().toggleKml(MainLayout.KML_LANDSLIDE, cb);
	        }
	    });
	    landslide.setStyleName("rvha-Hazards");
	    
	    flood = new CheckBox("100 year flood plain");
	    flood.addClickListener(new ClickListener() {
	        public void onClick(Widget sender) {
	        	CheckBox cb = (CheckBox) sender;
	        	if(cb.isChecked())
	        	{
	        		Window.alert("Not yet implemented");
	        		cb.setChecked(false);
	        	}
	        	//RapidVisualHazardAssessment.get().toggleKml(RapidVisualHazardAssessment.KML_LIQUEFACTION, cb.isChecked());
	        }
	    });
	    flood.setStyleName("rvha-Disabled");
	    
	    avalanchePaths = new CheckBox("Avalanche paths");
	    avalanchePaths.addClickListener(new ClickListener() {
	        public void onClick(Widget sender) {
	        	CheckBox cb = (CheckBox) sender;
	        	if(cb.isChecked())
	        	{
	        		Window.alert("Not yet implemented");
	        		cb.setChecked(false);
	        	}
	        	//RapidVisualHazardAssessment.get().toggleKml(RapidVisualHazardAssessment.KML_LIQUEFACTION, cb.isChecked());
	        }
	    });
	    avalanchePaths.setStyleName("rvha-Disabled");	    
	    
	    list.add(earthquake);
	    list.add(liquefaction);
	    list.add(landslide);
	    //list.add(flood);
	    //list.add(avalanchePaths);
	    
	    initWidget(panel);
	    setStyleName("rvha-Hazards"); // was mail-Tasks
	    
	}
}
